<extend name="Public/base" />
<block name="body">
	<style>
		a{
			cursor: pointer;
		}
		.hover{
			background-color:white !important;
			color:black !important;
		}
	</style>
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>订单管理/待发货订单</h2>
	</div>

	<!-- 高级搜索 -->
	<div class="user-center">
		<form class="search-form fr cf">
			<div class="controls" style="float:left;line-height:32px;height:34px;margin-right:5px;">
				<notempty name="start_time">
					<input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="{$start_time}">
					<else />
					<input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="">
				</notempty>
			</div>
			<div class="controls" style="float:left;line-height:32px;height:34px;margin-right:5px;">
				<notempty name="end_time">
					<input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="{$end_time}">
					<else />
					<input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="">
				</notempty>
			</div>
			<div class="controls" style="float:left;line-height:32px;height:34px;margin-right:5px;">
				<select name="type">
					<option value="">选择产品分类</option>
					<option value="1"<eq name="type" value="1">selected</eq> >抢购商品</option>
					<option value="2"<eq name="type" value="2">selected</eq> >预约商品</option>
					<option value="3"<eq name="type" value="3">selected</eq> >定制商品</option>
				</select>
				</div>
			<input type="hidden"  name="status" value="{$status}">
			<a class="sch-btn" href="javascript:;" id="search" url="admin.php?s=/Order/order.html"><i class="btn-search"></i></a>
			<a class="" href="javascript:;" id="search_data" url="admin.php?s=/Order/downloadexcel.html">导出数据</a>
		</form>
	</div>
	<!-- 数据列表 -->
	<div class="table-striped－main">
		<ul>
			<li><a href="admin.php?s=/Order/order/status/2.html" <eq name="status" value="2">class='hover'</eq>>待付款</a></li>
			<li><a href="admin.php?s=/Order/order/status/3.html" <eq name="status" value="3">class='hover'</eq>>待发货</a></li>
			<li><a href="admin.php?s=/Order/order/status/4.html" <eq name="status" value="4">class='hover'</eq>>已发货</a></li>
			<li><a href="admin.php?s=/Order/order/status/5.html" <eq name="status" value="5">class='hover'</eq>>待评价</a></li>
			<li><a href="admin.php?s=/Order/order/status/1.html" <eq name="status" value="1">class='hover'</eq>>已完成</a></li>
			<!--<li><a href="admin.php?s=/Order/orderretrun.html">退货退款</a></li>-->
			<li><a href="admin.php?s=/Order/order/status/10.html" <eq name="status" value="10">class='hover'</eq>>已取消</a></li>
		</ul>
	</div>


	<div class="table-striped" style="margin-top:10px;">
		<notempty name="_list">
			<volist name="_list" id="vo"  key="n">
				<div class="item-box">
					<div class="order-top">
						<div class="col-sm-4"><label>订单单号：</label>{$vo.order_no}</div>
						<div class="col-sm-4"><label>用户ID：</label>{$vo.user_id}</div>
						<div class="col-sm-4"><label>下单时间：</label>{$vo.create_time}</div>
					</div>
					<div class="item-table">
						<table>
							<!-- 表头 -->
							<tr>
								<th>订单类型 </th>
								<th rowspan="2" class="no-padding">
									<table>
										<tr>
											<th>商品信息</th><th>商品编码</th><th>数量</th>
										</tr>
										<volist name="vo['goodlist']" id="good">
											<tr>
												<td>
													<div class="goods-box">
														<div class="image-box"><img src="{$good.img_path}"></div>
														<div class="goods-detail">
															<p>{$good.good_name}</p>
															<small>{$good.sku}</small>
														</div>
													</div>
												</td><td>{$good.code}</td><td>{$good.count}</td>
											</tr>
										</volist>
									</table>
								</th>
								<th>实付款</th>
								<th>收货信息</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
							<tr>
								<td>{$vo.type_name}</td>
								<td>{$vo.amount}元</td>
								<td>{$vo.receiptinfo.province}{$vo.receiptinfo.city}{$vo.receiptinfo.area}{$vo.receiptinfo.address}<br>
									联系人：{$vo.receiptinfo.username}<br>
									联系人手机：{$vo.receiptinfo.phone}
								</td>
								<td><a>{$vo.status_name}</a></td>
								<td>
									{$vo.controller}
								</td>
							</tr>
						</table>
					</div>

				</div>
			</volist>
			<else/>
			<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>


		<div class="page">
			{$_page}
		</div>
		<div class="modal" style="display:none;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-express">
						<div class="modal-header"><button type="button" class="close modal-close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
							<h4 class="modal-title" id="gridModalLabel">请为该订单填写物流单号</h4>
						</div>
						<div class="modal-body">
							<div class="form-item">
								<span class="item_name" style="margin-left: -48px">快递公司：</span>
								<select style="margin-left: 15px" class="selection_1 textbox_296" id="express_type">
									<option value="1">顺丰</option>
									<option value="2">深通</option>
									<option value="3">圆通</option>
									<option value="4">韵达</option>
									<option value="5">大丰</option>
									<option value="6">诚信</option>
								</select>
							</div>
						</div>
						<div class="form-item">
							<span class="item_name" style="margin-left: -48px">快递单号：</span>
							<input class="textbox_296 " placeholder="快递单号..." type="text" style="margin-left: 15px" id="express_code" />
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-return modal-close" data-dismiss="modal" aria-label="Close">取消</button>
							<button type="button" class="btn btn-primary submit-btn-express">确定</button>
							<input value="" type="hidden" id="invest_code">
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="style">
	<link href="__PUBLIC__/static/jquery-datetimepicker/jquery-datetimepicker.css" rel="stylesheet" media="screen">
	<link rel="stylesheet" href="__PUBLIC__/static/kindeditor/default/default.css" />
</block>
<block name="script">
	<script type="text/javascript" src="__PUBLIC__/static/jquery-datetimepicker/jquery-datetimepicker.js"></script>
	<script type="text/javascript" charset="utf-8">

		$("#search_data").click(function(){
			var url = $(this).attr('url');
			var query  = $('.search-form').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
			query = query.replace(/^&/g,'');
			if( url.indexOf('?')>0 ){
				url += '&' + query;
			}else{
				url += '?' + query;
			}
			window.location.href = url;
		});
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
			var query  = $('.search-form').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
			query = query.replace(/^&/g,'');
			if( url.indexOf('?')>0 ){
				url += '&' + query;
			}else{
				url += '?' + query;
			}
			window.location.href = url;
		});
		//日期时间插件
		$('.date_picker').datetimepicker({
			lang:'ch',
			format:'Y-m-d H:00',
			timepicker:true,
			allowBlank:true
		});
		//导航高亮
		highlight_subnav('{:U('Order/order')}');

		$(".open-express").click(function(){
			var id = $(this).attr("code");
			$("#invest_code").val(id);
			$(".modal").show();
		})
		$('.submit-btn-express').on('click', function(){
			$(".modal").hide();
			var invest_id = $("#invest_code").val();
			var express_code = $("#express_code").val();
			var express_type = $("#express_type").val();
			$.post(
					'admin.php?s=/Order/changeexpress.html',
					{
						id:invest_id,express_code:express_code,express_type:express_type
					},
					function(responed){
						alert("新增成功");
						location.reload();
					}
			);
			return false;
		});
		$(' .modal-close').on('click', function(){
			$(".modal").hide();
		});
		$(function(){
			$('body').on('click', '.open-html', function(event){
				var id = $(this).attr("code");
				event.stopPropagation();
				var url = $(this).attr('href');
				if( !url )      return  false;
				var tips =  '评论信息',
						button = $(this).hasClass('open-delivery') ? true : false;
				load_html({
					url: url,
					title: tips,
					button: button
				});
				return false;

			});
		});
		$(".cacelorder").click(function(){
			var id = $(this).attr("code");
			if(confirm("确定取消订单吗")){
				$.post(
						'admin.php?s=/Order/cancelorder.html',
						{
							data: "",id:id
						},
						function(responed){
							alert("取消成功");
							location.reload();
						}
				);
			}
		})
		$(".changeamount").click(function(){
			$(this).parent().css("background-color","yellow")
			var id = $(this).attr("code");
			var name=prompt("请输入修改后的价格","")
			if (name!=null && name!="")
			{
				$.post(
						'admin.php?s=/Order/changeamount.html',
						{
							amount: name,id:id
						},
						function(responed){
							alert("修改成功");
							location.reload();
						}
				);
			}
		})


	</script>
	<script type="text/javascript" charset="utf-8">
		onload = function ()
		{
			setInterval (function ()
			{
				var date = new Date ();
//				txt.value = date.toLocaleDateString();
			});

		}

	</script>
</block>